package com.wmh.baseservice.operationaid.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wmh.baseservice.operationaid.entity.view.PddStoreDataView;

import java.util.List;
import java.util.stream.Collectors;

public interface PddStoreDataViewMapper extends BaseMapper<PddStoreDataView> {
    default List<String> getStoreOptions(){
        return selectList(new LambdaQueryWrapper<PddStoreDataView>()
                .groupBy(PddStoreDataView::getStoreName)
                .orderByDesc(PddStoreDataView::getCreateTime)
                .select(PddStoreDataView::getStoreName)
        ).stream().map(PddStoreDataView::getStoreName).collect(Collectors.toList());
    }
}
